package com.rockxin.cat.adapter;

import android.support.annotation.Nullable;
import android.support.v4.content.ContextCompat;
import android.widget.TextView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.rockxin.cat.R;

import java.util.List;

/**
 * <b>类名称：    MeAdapter             <br/>
 * <b>类描述：                        <br/>
 * <b>创建人：    Lans               <br/>
 * <b>创建时间：  2018/3/1 16:23     <br/>
 * <b>修改人：                        <br/>
 * <b>修改时间：                      <br/>
 * <b>修改备注：                      <br/>
 *
 * @version 1.0.0 <br/>
 */
public class MeAdapter extends BaseQuickAdapter<String, BaseViewHolder> {
    private Integer[] icon = {R.mipmap.account, R.mipmap.record, R.mipmap.manage, R.mipmap.redpacket};

    public MeAdapter(@Nullable List<String> data) {
        super(R.layout.fragment_me_item, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, String item) {
        final int layoutPosition = helper.getLayoutPosition();
        final TextView name = helper.getView(R.id.name);
        name.setText(item);
        name.setCompoundDrawablesWithIntrinsicBounds(ContextCompat.getDrawable(mContext, icon[layoutPosition-1
                ]), null, null, null);

        helper.addOnClickListener(R.id.name);
    }
}
